package com.qq.mall.controller;


import com.qq.mall.beans.ProductParams;
import com.qq.mall.service.ProductParamsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("/retaildemo/product-params")
@Api(tags = "商品参数")
public class ProductParamsController {
    @Resource
    private ProductParamsService productParamsService;
    @GetMapping("params/{id}")
    @ApiOperation("通过商品ID查询商品参数")
    public ProductParams getParams(@PathVariable("id") String id){
        ProductParams byId = productParamsService.getById(id);
        return byId;
    }
    @PostMapping("/addParams")
    @ApiOperation("添加商品参数")
    public boolean addparams(@RequestBody ProductParams productParams){
        return productParamsService.save(productParams);
    }
}

